/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../mixins/common.less';
@import '../custom.less';
@import './vars.less';

@crop-prefix-cls: ~'@{css-prefix}crop';
@croppreview-prefix-cls: ~'@{css-prefix}croppreview';

.@{crop-prefix-cls} {
  .component-css-vars-crop();

  .cropper-container {
    direction: ltr;
    font-size: 0;
    line-height: 0;
    position: relative;
    -ms-touch-action: none;
    touch-action: none;
    .user-select(none);
  }

  .cropper-container img {
    display: block;
    height: 100%;
    image-orientation: 0deg;
    max-height: none !important;
    max-width: none !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: 100%;
  }

  .cropper-wrap-box,
  .cropper-canvas,
  .cropper-drag-box,
  .cropper-crop-box,
  .cropper-modal {
    bottom: 0;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
  }

  .cropper-wrap-box,
  .cropper-canvas {
    overflow: hidden;
  }

  .cropper-drag-box {
    background-color: var(--ti-crop-drag-box-bg-color);
    opacity: 0;
  }

  .cropper-modal {
    background-color: var(--ti-crop-modal-bg-color);
    opacity: 0.5;
  }

  .cropper-view-box {
    display: block;
    height: 100%;
    outline-color: rgba(51, 153, 255, 0.75);
    outline: 1px solid var(--ti-crop-view-box-outline-color);
    overflow: hidden;
    width: 100%;
  }

  .cropper-dashed {
    border: 0 dashed #eee;
    display: block;
    opacity: 0.5;
    position: absolute;
  }

  .cropper-dashed.dashed-h {
    border-bottom-width: 1px;
    border-top-width: 1px;
    height: 33.33333%;
    left: 0;
    top: 33.33333%;
    width: 100%;
  }

  .cropper-dashed.dashed-v {
    border-left-width: 1px;
    border-right-width: 1px;
    height: 100%;
    left: 33.33333%;
    top: 0;
    width: 33.33333%;
  }

  .cropper-center {
    display: block;
    height: 0;
    left: 50%;
    opacity: 0.75;
    position: absolute;
    top: 50%;
    width: 0;
  }

  .cropper-center:before,
  .cropper-center:after {
    background-color: var(--ti-crop-center-bg-color);
    content: ' ';
    display: block;
    position: absolute;
  }

  .cropper-center:before {
    height: 1px;
    left: -3px;
    top: 0;
    width: 7px;
  }

  .cropper-center:after {
    height: 7px;
    left: 0;
    top: -3px;
    width: 1px;
  }

  .cropper-face,
  .cropper-line,
  .cropper-point {
    display: block;
    height: 100%;
    opacity: 0.1;
    position: absolute;
    width: 100%;
  }

  .cropper-face {
    background-color: var(--ti-crop-face-bg-color);
    left: 0;
    top: 0;
  }

  .cropper-line {
    background-color: var(--ti-crop-line-bg-color);
  }

  .cropper-line.line-e {
    cursor: ew-resize;
    right: -3px;
    top: 0;
    width: 5px;
  }

  .cropper-line.line-n {
    cursor: ns-resize;
    height: 5px;
    left: 0;
    top: -3px;
  }

  .cropper-line.line-w {
    cursor: ew-resize;
    left: -3px;
    top: 0;
    width: 5px;
  }

  .cropper-line.line-s {
    bottom: -3px;
    cursor: ns-resize;
    height: 5px;
    left: 0;
  }

  .cropper-point {
    background-color: var(--ti-crop-point-bg-color);
    height: 5px;
    opacity: 0.75;
    width: 5px;
  }

  .cropper-point.point-e {
    cursor: ew-resize;
    margin-top: -3px;
    right: -3px;
    top: 50%;
  }

  .cropper-point.point-n {
    cursor: ns-resize;
    left: 50%;
    margin-left: -3px;
    top: -3px;
  }

  .cropper-point.point-w {
    cursor: ew-resize;
    left: -3px;
    margin-top: -3px;
    top: 50%;
  }

  .cropper-point.point-s {
    bottom: -3px;
    cursor: s-resize;
    left: 50%;
    margin-left: -3px;
  }

  .cropper-point.point-ne {
    cursor: nesw-resize;
    right: -3px;
    top: -3px;
  }

  .cropper-point.point-nw {
    cursor: nwse-resize;
    left: -3px;
    top: -3px;
  }

  .cropper-point.point-sw {
    bottom: -3px;
    cursor: nesw-resize;
    left: -3px;
  }

  .cropper-point.point-se {
    bottom: -3px;
    cursor: nwse-resize;
    height: 20px;
    opacity: 1;
    right: -3px;
    width: 20px;
  }

  @media (min-width: 768px) {
    .cropper-point.point-se {
      height: 15px;
      width: 15px;
    }
  }

  @media (min-width: 992px) {
    .cropper-point.point-se {
      height: 10px;
      width: 10px;
    }
  }

  @media (min-width: 1200px) {
    .cropper-point.point-se {
      height: 5px;
      opacity: 0.75;
      width: 5px;
    }
  }

  .cropper-point.point-se:before {
    background-color: var(--ti-crop-point-bg-color);
    bottom: -50%;
    content: ' ';
    display: block;
    height: 200%;
    opacity: 0;
    position: absolute;
    right: -50%;
    width: 200%;
  }

  .cropper-invisible {
    opacity: 0;
  }

  .cropper-bg {
    background-image: url('');
  }

  .cropper-hide {
    display: block;
    height: 0;
    position: absolute;
    width: 0;
  }

  .cropper-hidden {
    display: none !important;
  }

  .cropper-move {
    cursor: move;
  }

  .cropper-crop {
    cursor: crosshair;
  }

  .cropper-disabled .cropper-drag-box,
  .cropper-disabled .cropper-face,
  .cropper-disabled .cropper-line,
  .cropper-disabled .cropper-point {
    cursor: not-allowed;
  }

  .img-container {
    margin: auto;
    overflow: hidden;
  }

  .img-container > img {
    max-width: 100%;
  }

  .opration {
    height: var(--ti-crop-opration-height);
    line-height: var(--ti-crop-opration-height);
    text-align: center;
    background-color: var(--ti-crop-opration-bg-color);
    position: relative;
  }

  .opration span {
    width: 26px;
    height: 26px;
    margin: 0 2px;
    display: inline-block;
    color: var(--ti-crop-opration-span-text-color);
    cursor: pointer;
    border-radius: 50%;
    background-color: var(--ti-crop-opration-span-bg-color);
  }

  .opration span:hover {
    background-color: var(--ti-crop-opration-span-hover-bg-color);
    width: 28px;
    height: 28px;
  }

  .opration span.@{css-prefix-iconfont}::before {
    position: relative;
  }

  .crop-modal-mask {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--ti-crop-modal-mask-bg-color);
    height: 100%;
    z-index: 1000;
  }

  .crop-modal-warp {
    position: fixed;
    overflow: auto;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    -webkit-overflow-scrolling: touch;
    outline: 0;
  }

  .crop-modal {
    position: relative;
    top: 100px;
    margin: 0 auto 50px;
    background: #fff;
    border-radius: 2px;
    box-sizing: border-box;
    width: 50%;
  }

  .moda-close {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 80px;
    height: 80px;
    cursor: pointer;
    border-radius: 50%;
    background-color: var(--ti-crop-moda-close-bg-color);
  }

  .moda-close .@{css-prefix-iconfont} {
    top: 45px;
    left: 16px;
    color: var(--ti-crop-moda-close-icon-color);
    z-index: 9999999;
  }

  .img-preview-box {
    position: fixed;
    top: 100px;
  }

  .img-preview {
    height: 9rem;
    width: 16rem;
    overflow: hidden;
  }

  @media (max-width: 768px) {
    .preview-lg {
      display: none;
    }
  }

  @media (max-width: 600px) {
    .preview-md {
      display: none;
    }
  }

  .preview-lg {
    height: 9rem;
    width: 16rem;
    margin-top: 4px;
  }

  .preview-md {
    height: 4.5rem;
    width: 8rem;
    margin-top: 4px;
  }

  .preview-sm {
    height: 2.25rem;
    width: 4rem;
    margin-top: 4px;
  }

  .img-preview > img {
    max-width: 100%;
  }

  .nopic {
    height: 200px;
    text-align: center;
    background: var(--ti-crop-nopic-bg-color);
  }

  .nopic-center {
    position: relative;
    font-size: 50px;
    color: var(--ti-crop-nopic-center-text-color);
    cursor: pointer;
    top: 50px;
  }

  input[type='file'] {
    display: none;
  }
}

.@{crop-prefix-cls} {
  position: fixed;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 0px;
  left: 0px;
  z-index: 1000;
  background: rgba(97, 97, 97, 0.5);

  &__dialog-content__handle {
    width: 652px;
    display: flex;
    justify-content: center;
    height: 26px;
    margin: 10px 0px 20px;
  }

  &__dialog-content__handle__button {
    width: 268px;
    display: flex;
    justify-content: space-between;
  }

  &__dialog {
    width: 652px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    background: white;
    z-index: 1001;
  }

  &__dialog-cropper {
    width: 652px;
    height: 300px;
    overflow: hidden;
  }

  &__dialog-content {
    width: 100%;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    justify-content: center;
  }

  &__dialog-content__crop {
    width: 314px;
    height: 200px;
    border: 1px solid #393939;
    box-sizing: border-box;
    background: gray;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;

    img {
      height: 100%;
      width: 100%;
    }
  }
}

.@{croppreview-prefix-cls} {
  position: fixed;
  top: calc(100% - 50% - 150px);
  left: calc(100% - 50% + 336px);
  height: 300px;
  width: 300px;
  display: flex;
  z-index: 1002;
  flex-direction: column;
  justify-content: space-between;
}

.iconButton {
  border-radius: 50%;
  background: rgb(97, 97, 97);
  height: 26px;
  width: 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;

  .iconButtonset {
    fill: white;
    height: 12px;
    width: 12px;
  }

  &:hover {
    background: rgb(39, 39, 39);
  }
}

.croppreview {
  height: 100%;
  width: 100%;
}

.croppreviewb {
  width: 214px;
  height: 140px;
  overflow: hidden;
  background: white;
}

.croppreviewm {
  width: 114px;
  height: 80px;
  overflow: hidden;
  background: white;
}

.croppreviews {
  width: 84px;
  height: 60px;
  overflow: hidden;
  background: white;
}
